import request from '@/utils/request'

/**
 * 获取所有角色列表
 */
export const getRoleList = params => {
  return request({
    url: '/sys/role',
    params
  })
}

/**
 * 根据id查询企业
 */
export const getCompanyInfo = id => {
  return request({
    url: `/company/${id}`
  })
}

/**
 * 根据id删除角色
 */
export const deleteRoleById = id => {
  return request({
    method: 'DELETE',
    url: `/sys/role/${id}`
  })
}

/**
 * 修改角色
 */
export const updateRoleById = data => {
  return request({
    method: 'PUT',
    url: `/sys/role/${data.id}`,
    data
  })
}

/**
 * 获取角色详情
 */
export const getRoleDetail = id => {
  return request({
    url: `/sys/role/${id}`
  })
}

/**
 *
 * 增加角色
 */
export const addRole = data => {
  return request({
    method: 'POST',
    url: `/sys/role`,
    data
  })
}

/** *
 * 给用户分配角色
 * ***/
export const assignRoles = data => {
  return request({
    url: '/sys/user/assignRoles',
    data,
    method: 'put'
  })
}
